<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

$paths = array(realpath(APPLICATION_PATH . '/../library'));
if (function_exists('zend_deployment_library_path') && zend_deployment_library_path('Zend Framework 1')) {
        $paths[] = zend_deployment_library_path('Zend Framework 1');
}
$paths[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $paths));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);


date_default_timezone_set('Asia/Ho_Chi_Minh');
//Define path to layout directory
define('TEMPLATE_PATH', realpath(dirname(__FILE__).'/template'));
define('LAYOUT_PATH', TEMPLATE_PATH.'/layout');

//Defined url to layout
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$baseUrl = $config->baseHttp;
$basePath = $config->basePath;
define('_BASE_URL', $baseUrl);
define('_BASE_PATH', realpath(dirname(__FILE__)));
define('TEMPLATE_URL', $baseUrl.'/template');
define('LAYOUT_URL', $baseUrl.'/template/layout');
define('PUBLIC_URL', $baseUrl.'/template');

$application->bootstrap()->run();